package com.scau.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.scau.dao.AdminDao;
import com.scau.pojo.Admin;
import com.scau.pojo.Student;
import com.scau.service.AdminService;
@Service
public class AdminServiceImpl implements AdminService{
	@Autowired
	AdminDao adminDAO;
	
	@Override
	public List<Admin> getAllAdmin(){
		return adminDAO.getAllAdmin();
	}

	@Override
	public int updateAdmin(JSONObject jsonObject) {
		int result=0;
		Admin admin=new Admin();
		int id=jsonObject.getInteger("id");
		String password=jsonObject.getString("password");
		String tel=jsonObject.getString("tel");
		admin.setId(id);
		admin.setPassword(password);
		admin.setTel(tel);
		try {
			result=adminDAO.update(admin);
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
		return result;
	}
}
